package com.fare.taluo.core.domain.crawl;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import com.dayatang.domain.InstanceFactory;


@javax.persistence.Table(name = "CRAWL_TASK_TEMPLATE_ASSIGNDAY")
@javax.persistence.Entity
public class TaskAssignDayEntity extends 
com.fare.taluo.base.ddd.domain.baseentity.BaseEntity{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -9179598305411900674L;

//	@Id
//	@GeneratedValue(strategy = GenerationType.AUTO)
//	@Column(name = "id")
//	private Long id;
	
	@ManyToOne
	@JoinColumn(name="TEMPLATE_ID")
	private TaskTemplateEntity taskTemplateEntity;

	@Column(name="ASSIGN_FLIGHT_DAY")
	private int assignFlightDay; //指定的距离当天的起飞间隔时间
	
	@Column(name="ASSIGN_ROUND_DAY")
	private int assignRoundDay;  //指定的距离指定的起飞时间的回程间隔时间
	
	
	private static TaskAssignDayEntityRepository getTaskAssignDayEntityRepository(){
		return InstanceFactory.getInstance(TaskAssignDayEntityRepository.class);
	}

	public void remove(){
		getTaskAssignDayEntityRepository().remove(this);
	}
	
	public void remove(TaskAssignDayEntity entity) throws Exception{
		getTaskAssignDayEntityRepository().deleteTaskAssignDayEntity(entity);
	}
	
	public void saveOrUpdate(){
		getTaskAssignDayEntityRepository().save(this);
	}
	
	public void saveOrUpdate(TaskAssignDayEntity entity) throws Exception{
		getTaskAssignDayEntityRepository().saveOrUpdate(entity);
	}
	
	public TaskAssignDayEntity get(long id) throws Exception{
		return getTaskAssignDayEntityRepository().findTaskAssignDayEntityById(id);
	}
	
	public List<TaskAssignDayEntity> findTaskAssignDayEntityByTempId(long tempId) throws Exception{
		return getTaskAssignDayEntityRepository().findTaskAssignDayEntityByTempId(tempId);
	}
	
	

	public TaskTemplateEntity getTaskTemplateEntity() {
		return taskTemplateEntity;
	}

	public void setTaskTemplateEntity(TaskTemplateEntity taskTemplateEntity) {
		this.taskTemplateEntity = taskTemplateEntity;
	}

	public int getAssignFlightDay() {
		return assignFlightDay;
	}



	public void setAssignFlightDay(int assignFlightDay) {
		this.assignFlightDay = assignFlightDay;
	}



	public int getAssignRoundDay() {
		return assignRoundDay;
	}



	public void setAssignRoundDay(int assignRoundDay) {
		this.assignRoundDay = assignRoundDay;
	}
}
